package com.reremouse.rerebbs.web.mb.mag;

import com.reremouse.model.SystemConfig;
import com.reremouse.rerebbs.dao.ISystemConfigDAO;
import com.reremouse.rerebbs.web.mb.ApplicationBean;
import com.reremouse.util.JsfHelper;
import com.reremouse.util.SpringHelper;

import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import java.io.Serializable;

@ManagedBean
@ViewScoped
public class AlterFilePath
        implements Serializable {
    SystemConfig scm;
    ISystemConfigDAO systemConfigDAO = (ISystemConfigDAO) SpringHelper.getSpringBean("SystemConfigDAO");

    public SystemConfig getScm() {
        return this.scm;
    }

    public void setScm(SystemConfig scm) {
        this.scm = scm;
    }

    @PostConstruct
    public void init() {
        setScm(this.systemConfigDAO.getSystemConfig());
    }

    public String finish() {
        this.systemConfigDAO.updateSystemConfig(getScm());
        ApplicationBean ab = (ApplicationBean) JsfHelper.getBean("applicationBean");
        ab.loadFilePath();
        FacesMessage fm = new FacesMessage();
        fm.setSeverity(FacesMessage.SEVERITY_INFO);
        fm.setSummary("update success");
        FacesContext.getCurrentInstance().addMessage("", fm);
        return null;
    }
}



/* Location:           F:\jsp源码\蝙蝠论坛系统\rerebbs\WEB-INF\classes\

 * Qualified Name:     com.reremouse.rerebbs.web.mb.mag.AlterFilePath

 * JD-Core Version:    0.7.0.1

 */